
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>16. Generic Operating System Services &#8212; Python 3.6.6rc1 文档</title>
    <link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript" src="../_static/documentation_options.js"></script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <script type="text/javascript" src="../_static/sidebar.js"></script>
    <link rel="search" type="application/opensearchdescription+xml"
          title="在 Python 3.6.6rc1 文档 中搜索"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="关于这些文档" href="../about.html" />
    <link rel="index" title="索引" href="../genindex.html" />
    <link rel="search" title="搜索" href="../search.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="next" title="16.1. os --- Miscellaneous operating system interfaces" href="os.html" />
    <link rel="prev" title="15.3. secrets --- Generate secure random numbers for managing secrets" href="secrets.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />
    <link rel="canonical" href="https://docs.python.org/3/library/allos.html" />
    
    <script type="text/javascript" src="../_static/copybutton.js"></script>
    <script type="text/javascript" src="../_static/switchers.js"></script>
    
    
 

  </head><body>  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>导航</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">索引</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python 模块索引"
             >模块</a> |</li>
        <li class="right" >
          <a href="os.html" title="16.1. os --- Miscellaneous operating system interfaces"
             accesskey="N">下一页</a> |</li>
        <li class="right" >
          <a href="secrets.html" title="15.3. secrets --- Generate secure random numbers for managing secrets"
             accesskey="P">上一页</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &#187;</li>
        <li>
          <span class="language_switcher_placeholder">zh</span>
          <span class="version_switcher_placeholder">3.6.6rc1</span>
          <a href="../index.html">Documentation </a> &#187;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">The Python Standard Library</a> &#187;</li>
    <li class="right">
        

    <div class="inline-search" style="display: none" role="search">
        <form class="inline-search" action="../search.html" method="get">
          <input placeholder="Quick search" type="text" name="q" />
          <input type="submit" value="Go" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    <script type="text/javascript">$('.inline-search').show(0);</script>
         |
    </li>

      </ul>
    </div>    

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="generic-operating-system-services">
<span id="allos"></span><h1>16. Generic Operating System Services<a class="headerlink" href="#generic-operating-system-services" title="永久链接至标题">¶</a></h1>
<p>The modules described in this chapter provide interfaces to operating system
features that are available on (almost) all operating systems, such as files and
a clock.  The interfaces are generally modeled after the Unix or C interfaces,
but they are available on most other systems as well.  Here's an overview:</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="os.html">16.1. <code class="docutils literal notranslate"><span class="pre">os</span></code> --- Miscellaneous operating system interfaces</a><ul>
<li class="toctree-l2"><a class="reference internal" href="os.html#file-names-command-line-arguments-and-environment-variables">16.1.1. File Names, Command Line Arguments, and Environment Variables</a></li>
<li class="toctree-l2"><a class="reference internal" href="os.html#process-parameters">16.1.2. Process Parameters</a></li>
<li class="toctree-l2"><a class="reference internal" href="os.html#file-object-creation">16.1.3. File Object Creation</a></li>
<li class="toctree-l2"><a class="reference internal" href="os.html#file-descriptor-operations">16.1.4. File Descriptor Operations</a><ul>
<li class="toctree-l3"><a class="reference internal" href="os.html#querying-the-size-of-a-terminal">16.1.4.1. Querying the size of a terminal</a></li>
<li class="toctree-l3"><a class="reference internal" href="os.html#inheritance-of-file-descriptors">16.1.4.2. Inheritance of File Descriptors</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="os.html#files-and-directories">16.1.5. Files and Directories</a><ul>
<li class="toctree-l3"><a class="reference internal" href="os.html#linux-extended-attributes">16.1.5.1. Linux extended attributes</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="os.html#process-management">16.1.6. Process Management</a></li>
<li class="toctree-l2"><a class="reference internal" href="os.html#interface-to-the-scheduler">16.1.7. Interface to the scheduler</a></li>
<li class="toctree-l2"><a class="reference internal" href="os.html#miscellaneous-system-information">16.1.8. Miscellaneous System Information</a></li>
<li class="toctree-l2"><a class="reference internal" href="os.html#random-numbers">16.1.9. Random numbers</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="io.html">16.2. <code class="docutils literal notranslate"><span class="pre">io</span></code> --- Core tools for working with streams</a><ul>
<li class="toctree-l2"><a class="reference internal" href="io.html#overview">16.2.1. Overview</a><ul>
<li class="toctree-l3"><a class="reference internal" href="io.html#text-i-o">16.2.1.1. Text I/O</a></li>
<li class="toctree-l3"><a class="reference internal" href="io.html#binary-i-o">16.2.1.2. Binary I/O</a></li>
<li class="toctree-l3"><a class="reference internal" href="io.html#raw-i-o">16.2.1.3. Raw I/O</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="io.html#high-level-module-interface">16.2.2. High-level Module Interface</a><ul>
<li class="toctree-l3"><a class="reference internal" href="io.html#in-memory-streams">16.2.2.1. In-memory streams</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="io.html#class-hierarchy">16.2.3. Class hierarchy</a><ul>
<li class="toctree-l3"><a class="reference internal" href="io.html#i-o-base-classes">16.2.3.1. I/O Base Classes</a></li>
<li class="toctree-l3"><a class="reference internal" href="io.html#raw-file-i-o">16.2.3.2. Raw File I/O</a></li>
<li class="toctree-l3"><a class="reference internal" href="io.html#buffered-streams">16.2.3.3. Buffered Streams</a></li>
<li class="toctree-l3"><a class="reference internal" href="io.html#id1">16.2.3.4. Text I/O</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="io.html#performance">16.2.4. Performance</a><ul>
<li class="toctree-l3"><a class="reference internal" href="io.html#id2">16.2.4.1. Binary I/O</a></li>
<li class="toctree-l3"><a class="reference internal" href="io.html#id3">16.2.4.2. Text I/O</a></li>
<li class="toctree-l3"><a class="reference internal" href="io.html#multi-threading">16.2.4.3. Multi-threading</a></li>
<li class="toctree-l3"><a class="reference internal" href="io.html#reentrancy">16.2.4.4. Reentrancy</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="time.html">16.3. <code class="docutils literal notranslate"><span class="pre">time</span></code> --- Time access and conversions</a><ul>
<li class="toctree-l2"><a class="reference internal" href="time.html#functions">16.3.1. Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="time.html#clock-id-constants">16.3.2. Clock ID Constants</a></li>
<li class="toctree-l2"><a class="reference internal" href="time.html#timezone-constants">16.3.3. Timezone Constants</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="argparse.html">16.4. <code class="docutils literal notranslate"><span class="pre">argparse</span></code> --- Parser for command-line options, arguments and sub-commands</a><ul>
<li class="toctree-l2"><a class="reference internal" href="argparse.html#example">16.4.1. Example</a><ul>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#creating-a-parser">16.4.1.1. Creating a parser</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#adding-arguments">16.4.1.2. Adding arguments</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#parsing-arguments">16.4.1.3. Parsing arguments</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="argparse.html#argumentparser-objects">16.4.2. ArgumentParser objects</a><ul>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#prog">16.4.2.1. prog</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#usage">16.4.2.2. usage</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#description">16.4.2.3. description</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#epilog">16.4.2.4. epilog</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#parents">16.4.2.5. parents</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#formatter-class">16.4.2.6. formatter_class</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#prefix-chars">16.4.2.7. prefix_chars</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#fromfile-prefix-chars">16.4.2.8. fromfile_prefix_chars</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#argument-default">16.4.2.9. argument_default</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#allow-abbrev">16.4.2.10. allow_abbrev</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#conflict-handler">16.4.2.11. conflict_handler</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#add-help">16.4.2.12. add_help</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="argparse.html#the-add-argument-method">16.4.3. The add_argument() method</a><ul>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#name-or-flags">16.4.3.1. name or flags</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#action">16.4.3.2. action</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#nargs">16.4.3.3. nargs</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#const">16.4.3.4. const</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#default">16.4.3.5. default</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#type">16.4.3.6. type</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#choices">16.4.3.7. choices</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#required">16.4.3.8. required</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#help">16.4.3.9. help</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#metavar">16.4.3.10. metavar</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#dest">16.4.3.11. dest</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#action-classes">16.4.3.12. Action classes</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="argparse.html#the-parse-args-method">16.4.4. The parse_args() method</a><ul>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#option-value-syntax">16.4.4.1. Option value syntax</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#invalid-arguments">16.4.4.2. Invalid arguments</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#arguments-containing">16.4.4.3. Arguments containing <code class="docutils literal notranslate"><span class="pre">-</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#argument-abbreviations-prefix-matching">16.4.4.4. Argument abbreviations (prefix matching)</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#beyond-sys-argv">16.4.4.5. Beyond <code class="docutils literal notranslate"><span class="pre">sys.argv</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#the-namespace-object">16.4.4.6. The Namespace object</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="argparse.html#other-utilities">16.4.5. Other utilities</a><ul>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#sub-commands">16.4.5.1. Sub-commands</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#filetype-objects">16.4.5.2. FileType objects</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#argument-groups">16.4.5.3. Argument groups</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#mutual-exclusion">16.4.5.4. Mutual exclusion</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#parser-defaults">16.4.5.5. Parser defaults</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#printing-help">16.4.5.6. Printing help</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#partial-parsing">16.4.5.7. Partial parsing</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#customizing-file-parsing">16.4.5.8. Customizing file parsing</a></li>
<li class="toctree-l3"><a class="reference internal" href="argparse.html#exiting-methods">16.4.5.9. Exiting methods</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="argparse.html#upgrading-optparse-code">16.4.6. Upgrading optparse code</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="getopt.html">16.5. <code class="docutils literal notranslate"><span class="pre">getopt</span></code> --- C-style parser for command line options</a></li>
<li class="toctree-l1"><a class="reference internal" href="logging.html">16.6. <code class="docutils literal notranslate"><span class="pre">logging</span></code> --- Logging facility for Python</a><ul>
<li class="toctree-l2"><a class="reference internal" href="logging.html#logger-objects">16.6.1. Logger Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.html#logging-levels">16.6.2. Logging Levels</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.html#handler-objects">16.6.3. Handler Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.html#formatter-objects">16.6.4. Formatter Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.html#filter-objects">16.6.5. Filter Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.html#logrecord-objects">16.6.6. LogRecord Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.html#logrecord-attributes">16.6.7. LogRecord attributes</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.html#loggeradapter-objects">16.6.8. LoggerAdapter Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.html#thread-safety">16.6.9. Thread Safety</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.html#module-level-functions">16.6.10. Module-Level Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.html#module-level-attributes">16.6.11. Module-Level Attributes</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.html#integration-with-the-warnings-module">16.6.12. Integration with the warnings module</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="logging.config.html">16.7. <code class="docutils literal notranslate"><span class="pre">logging.config</span></code> --- Logging configuration</a><ul>
<li class="toctree-l2"><a class="reference internal" href="logging.config.html#configuration-functions">16.7.1. Configuration functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.config.html#configuration-dictionary-schema">16.7.2. Configuration dictionary schema</a><ul>
<li class="toctree-l3"><a class="reference internal" href="logging.config.html#dictionary-schema-details">16.7.2.1. Dictionary Schema Details</a></li>
<li class="toctree-l3"><a class="reference internal" href="logging.config.html#incremental-configuration">16.7.2.2. Incremental Configuration</a></li>
<li class="toctree-l3"><a class="reference internal" href="logging.config.html#object-connections">16.7.2.3. Object connections</a></li>
<li class="toctree-l3"><a class="reference internal" href="logging.config.html#user-defined-objects">16.7.2.4. User-defined objects</a></li>
<li class="toctree-l3"><a class="reference internal" href="logging.config.html#access-to-external-objects">16.7.2.5. Access to external objects</a></li>
<li class="toctree-l3"><a class="reference internal" href="logging.config.html#access-to-internal-objects">16.7.2.6. Access to internal objects</a></li>
<li class="toctree-l3"><a class="reference internal" href="logging.config.html#import-resolution-and-custom-importers">16.7.2.7. Import resolution and custom importers</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="logging.config.html#configuration-file-format">16.7.3. Configuration file format</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="logging.handlers.html">16.8. <code class="docutils literal notranslate"><span class="pre">logging.handlers</span></code> --- Logging handlers</a><ul>
<li class="toctree-l2"><a class="reference internal" href="logging.handlers.html#streamhandler">16.8.1. StreamHandler</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.handlers.html#filehandler">16.8.2. FileHandler</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.handlers.html#nullhandler">16.8.3. NullHandler</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.handlers.html#watchedfilehandler">16.8.4. WatchedFileHandler</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.handlers.html#baserotatinghandler">16.8.5. BaseRotatingHandler</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.handlers.html#rotatingfilehandler">16.8.6. RotatingFileHandler</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.handlers.html#timedrotatingfilehandler">16.8.7. TimedRotatingFileHandler</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.handlers.html#sockethandler">16.8.8. SocketHandler</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.handlers.html#datagramhandler">16.8.9. DatagramHandler</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.handlers.html#sysloghandler">16.8.10. SysLogHandler</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.handlers.html#nteventloghandler">16.8.11. NTEventLogHandler</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.handlers.html#smtphandler">16.8.12. SMTPHandler</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.handlers.html#memoryhandler">16.8.13. MemoryHandler</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.handlers.html#httphandler">16.8.14. HTTPHandler</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.handlers.html#queuehandler">16.8.15. QueueHandler</a></li>
<li class="toctree-l2"><a class="reference internal" href="logging.handlers.html#queuelistener">16.8.16. QueueListener</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="getpass.html">16.9. <code class="docutils literal notranslate"><span class="pre">getpass</span></code> --- Portable password input</a></li>
<li class="toctree-l1"><a class="reference internal" href="curses.html">16.10. <code class="docutils literal notranslate"><span class="pre">curses</span></code> --- Terminal handling for character-cell displays</a><ul>
<li class="toctree-l2"><a class="reference internal" href="curses.html#functions">16.10.1. Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="curses.html#window-objects">16.10.2. Window Objects</a></li>
<li class="toctree-l2"><a class="reference internal" href="curses.html#constants">16.10.3. Constants</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="curses.html#module-curses.textpad">16.11. <code class="docutils literal notranslate"><span class="pre">curses.textpad</span></code> --- Text input widget for curses programs</a><ul>
<li class="toctree-l2"><a class="reference internal" href="curses.html#textbox-objects">16.11.1. Textbox objects</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="curses.ascii.html">16.12. <code class="docutils literal notranslate"><span class="pre">curses.ascii</span></code> --- Utilities for ASCII characters</a></li>
<li class="toctree-l1"><a class="reference internal" href="curses.panel.html">16.13. <code class="docutils literal notranslate"><span class="pre">curses.panel</span></code> --- A panel stack extension for curses</a><ul>
<li class="toctree-l2"><a class="reference internal" href="curses.panel.html#functions">16.13.1. Functions</a></li>
<li class="toctree-l2"><a class="reference internal" href="curses.panel.html#panel-objects">16.13.2. Panel Objects</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="platform.html">16.14. <code class="docutils literal notranslate"><span class="pre">platform</span></code> ---  Access to underlying platform's identifying data</a><ul>
<li class="toctree-l2"><a class="reference internal" href="platform.html#cross-platform">16.14.1. Cross Platform</a></li>
<li class="toctree-l2"><a class="reference internal" href="platform.html#java-platform">16.14.2. Java Platform</a></li>
<li class="toctree-l2"><a class="reference internal" href="platform.html#windows-platform">16.14.3. Windows Platform</a><ul>
<li class="toctree-l3"><a class="reference internal" href="platform.html#win95-98-specific">16.14.3.1. Win95/98 specific</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="platform.html#mac-os-platform">16.14.4. Mac OS Platform</a></li>
<li class="toctree-l2"><a class="reference internal" href="platform.html#unix-platforms">16.14.5. Unix Platforms</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="errno.html">16.15. <code class="docutils literal notranslate"><span class="pre">errno</span></code> --- Standard errno system symbols</a></li>
<li class="toctree-l1"><a class="reference internal" href="ctypes.html">16.16. <code class="docutils literal notranslate"><span class="pre">ctypes</span></code> --- A foreign function library for Python</a><ul>
<li class="toctree-l2"><a class="reference internal" href="ctypes.html#ctypes-tutorial">16.16.1. ctypes tutorial</a><ul>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#loading-dynamic-link-libraries">16.16.1.1. Loading dynamic link libraries</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#accessing-functions-from-loaded-dlls">16.16.1.2. Accessing functions from loaded dlls</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#calling-functions">16.16.1.3. Calling functions</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#fundamental-data-types">16.16.1.4. Fundamental data types</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#calling-functions-continued">16.16.1.5. Calling functions, continued</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#calling-functions-with-your-own-custom-data-types">16.16.1.6. Calling functions with your own custom data types</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#specifying-the-required-argument-types-function-prototypes">16.16.1.7. Specifying the required argument types (function prototypes)</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#return-types">16.16.1.8. Return types</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#passing-pointers-or-passing-parameters-by-reference">16.16.1.9. Passing pointers (or: passing parameters by reference)</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#structures-and-unions">16.16.1.10. Structures and unions</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#structure-union-alignment-and-byte-order">16.16.1.11. Structure/union alignment and byte order</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#bit-fields-in-structures-and-unions">16.16.1.12. Bit fields in structures and unions</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#arrays">16.16.1.13. Arrays</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#pointers">16.16.1.14. Pointers</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#type-conversions">16.16.1.15. Type conversions</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#incomplete-types">16.16.1.16. Incomplete Types</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#callback-functions">16.16.1.17. Callback functions</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#accessing-values-exported-from-dlls">16.16.1.18. Accessing values exported from dlls</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#surprises">16.16.1.19. Surprises</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#variable-sized-data-types">16.16.1.20. Variable-sized data types</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="ctypes.html#ctypes-reference">16.16.2. ctypes reference</a><ul>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#finding-shared-libraries">16.16.2.1. Finding shared libraries</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#loading-shared-libraries">16.16.2.2. Loading shared libraries</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#foreign-functions">16.16.2.3. Foreign functions</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#function-prototypes">16.16.2.4. Function prototypes</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#utility-functions">16.16.2.5. Utility functions</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#data-types">16.16.2.6. Data types</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#ctypes-fundamental-data-types-2">16.16.2.7. Fundamental data types</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#structured-data-types">16.16.2.8. Structured data types</a></li>
<li class="toctree-l3"><a class="reference internal" href="ctypes.html#arrays-and-pointers">16.16.2.9. Arrays and pointers</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h4>上一个主题</h4>
  <p class="topless"><a href="secrets.html"
                        title="上一章">15.3. <code class="docutils literal notranslate"><span class="pre">secrets</span></code> --- Generate secure random numbers for managing secrets</a></p>
  <h4>下一个主题</h4>
  <p class="topless"><a href="os.html"
                        title="下一章">16.1. <code class="docutils literal notranslate"><span class="pre">os</span></code> --- Miscellaneous operating system interfaces</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../bugs.html">Report a Bug</a></li>
      <li>
        <a href="https://github.com/python/cpython/blob/3.6/Doc/library/allos.rst"
            rel="nofollow">Show Source
        </a>
      </li>
    </ul>
  </div>
        </div>
      </div>
      <div class="clearer"></div>
    </div>  
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>导航</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             >索引</a></li>
        <li class="right" >
          <a href="../py-modindex.html" title="Python 模块索引"
             >模块</a> |</li>
        <li class="right" >
          <a href="os.html" title="16.1. os --- Miscellaneous operating system interfaces"
             >下一页</a> |</li>
        <li class="right" >
          <a href="secrets.html" title="15.3. secrets --- Generate secure random numbers for managing secrets"
             >上一页</a> |</li>
        <li><img src="../_static/py.png" alt=""
                 style="vertical-align: middle; margin-top: -1px"/></li>
        <li><a href="https://www.python.org/">Python</a> &#187;</li>
        <li>
          <span class="language_switcher_placeholder">zh</span>
          <span class="version_switcher_placeholder">3.6.6rc1</span>
          <a href="../index.html">Documentation </a> &#187;
        </li>

          <li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
    <li class="right">
        

    <div class="inline-search" style="display: none" role="search">
        <form class="inline-search" action="../search.html" method="get">
          <input placeholder="Quick search" type="text" name="q" />
          <input type="submit" value="Go" />
          <input type="hidden" name="check_keywords" value="yes" />
          <input type="hidden" name="area" value="default" />
        </form>
    </div>
    <script type="text/javascript">$('.inline-search').show(0);</script>
         |
    </li>

      </ul>
    </div>  
    <div class="footer">
    &copy; <a href="../copyright.html">Copyright</a> 2001-2018, Python Software Foundation.
    <br />
    The Python Software Foundation is a non-profit corporation.
    <a href="https://www.python.org/psf/donations/">Please donate.</a>
    <br />
    Last updated on 6月 24, 2018.
    <a href="../bugs.html">Found a bug</a>?
    <br />
    Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.7.2.
    </div>

  </body>
</html>